package com.tm.chargecar.service.impl;

import com.tm.chargecar.dto.ElectronicCardUserDto;
import com.tm.chargecar.entity.ElectronicCardUserEntity;
import com.tm.chargecar.mapper.ElectronicCardUserMapper;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.ElectronicCardUserService;
import com.tm.chargecar.utils.PageUtil;
import com.tm.chargecar.vo.ElectronicCardUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 该死了
 * @create 2022-08-24 14:51
 */
@Service
public class ElectronicCardUserServiceImpl implements ElectronicCardUserService {
    @Autowired
    private ElectronicCardUserMapper electronicCardUserMapper;
    //用户卡条件查询
    @Override
    public Result electronicCardUserQuery(ElectronicCardUserVo electronicCardUserVo) {
        //查询总条数
        Long total=electronicCardUserMapper.total(electronicCardUserVo);
       //把总条数放到分页工具包
        PageUtil pageUtil=new PageUtil();
        pageUtil.setTotalCount(total);
        //根据条件查询数据
        List<ElectronicCardUserDto> list=electronicCardUserMapper.data(electronicCardUserVo);
        pageUtil.setData(list);
        return Result.SUCCESS(pageUtil);
    }
}
